package com.example.tccdemo.controller;

import com.example.tccdemo.service.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * @describte:TODO
 * @program:distribute-transaction
 * @author:zhengdp
 * @create:2021-09-26 22:12:40
 **/
@RestController
public class PaymentController {
    @Autowired
    private PaymentService paymentService;

    @RequestMapping(value = "payment",method = RequestMethod.GET)
    public String payment(int userId, int orderId, BigDecimal amount){
        int result = paymentService.payment(userId,orderId,amount);
        return "支付结果"+ result;
    }

    @RequestMapping(value = "paymentMQ",method = RequestMethod.GET)
    public String paymentMQ(int userId, int orderId, BigDecimal amount) throws Exception {
        int result = paymentService.paymentMQ(userId,orderId,amount);
        return "支付结果"+ result;
    }
}
